import java.util.Scanner;

/**
 * 【程序26】   
 * 题目：请输入星期几的第一个字母来判断一下是星期几，
 * 如果第一个字母一样，则继续判断第二个字母。
 */
public class test26 {
    public static void main(String[] args) {
        String mon = "monday";
        String tue = "tuesday";
        String wed = "wednesday";
        String thu = "thursday";
        String fri = "friday";
        String sat = "saturday";
        String sun = "sunday";
        Scanner sc = new Scanner(System.in);
        loop:
        while (true) {
            System.out.print("请输入首字母：");
            String letter = sc.next();
            char[] ch = letter.toCharArray();
            if (mon.charAt(0) == ch[0]) {//周一
                for (int j = 1; j < mon.length(); j++) {
                    System.out.print("请继续输入单个字母：");
                    letter = sc.next();
                    ch = letter.toCharArray();
                    if (mon.charAt(j) != ch[0]) {
                        System.out.println("输入错误！");
                        break;
                    } else if (j == mon.length() - 1) {
                        System.out.println("输入正确，结果为：" + mon);
                        break loop;
                    }
                }
            }else if (wed.charAt(0) == ch[0]) {//周三
                for (int j = 1; j < wed.length(); j++) {
                    System.out.print("请继续输入单个字母：");
                    letter = sc.next();
                    ch = letter.toCharArray();
                    if (wed.charAt(j) != ch[0]) {
                        System.out.println("输入错误！");
                        break;
                    } else if (j == wed.length() - 1) {
                        System.out.println("输入正确，结果为：" + wed);
                        break loop;
                    }
                }
            }else if (fri.charAt(0) == ch[0]) {//周五
                for (int j = 1; j < fri.length(); j++) {
                    System.out.print("请继续输入单个字母：");
                    letter = sc.next();
                    ch = letter.toCharArray();
                    if (fri.charAt(j) != ch[0]) {
                        System.out.println("输入错误！");
                        break;
                    } else if (j == fri.length() - 1) {
                        System.out.println("输入正确，结果为：" + fri);
                        break loop;
                    }
                }
            }else if ('t' == ch[0]){//周二或周四
                System.out.print("请继续输入单个字母：");
                letter = sc.next();
                ch = letter.toCharArray();
                if (tue.charAt(1) == ch[0]) {//周二
                    for (int j = 2; j < tue.length(); j++) {
                        System.out.print("请继续输入单个字母：");
                        letter = sc.next();
                        ch = letter.toCharArray();
                        if (tue.charAt(j) != ch[0]) {
                            System.out.println("输入错误！");
                            break;
                        } else if (j == tue.length() - 1) {
                            System.out.println("输入正确，结果为：" + tue);
                            break loop;
                        }
                    }
                }else if (thu.charAt(1)==ch[0]){
                    for (int j = 2; j < thu.length(); j++) {
                        System.out.print("请继续输入单个字母：");
                        letter = sc.next();
                        ch = letter.toCharArray();
                        if (thu.charAt(j) != ch[0]) {
                            System.out.println("输入错误！");
                            break;
                        } else if (j == thu.length() - 1) {
                            System.out.println("输入正确，结果为：" + thu);
                            break loop;
                        }
                    }
                }else {
                    System.out.println("输入错误！");
                }
            }else if ('s' == ch[0]){//周六或周日
                System.out.print("请继续输入单个字母：");
                letter = sc.next();
                ch = letter.toCharArray();
                if (sat.charAt(1) == ch[0]) {//周二
                    for (int j = 2; j < sat.length(); j++) {
                        System.out.print("请继续输入单个字母：");
                        letter = sc.next();
                        ch = letter.toCharArray();
                        if (sat.charAt(j) != ch[0]) {
                            System.out.println("输入错误！");
                            break;
                        } else if (j == sat.length() - 1) {
                            System.out.println("输入正确，结果为：" + sat);
                            break loop;
                        }
                    }
                }else if (sun.charAt(1)==ch[0]){
                    for (int j = 2; j < sun.length(); j++) {
                        System.out.print("请继续输入单个字母：");
                        letter = sc.next();
                        ch = letter.toCharArray();
                        if (sun.charAt(j) != ch[0]) {
                            System.out.println("输入错误！");
                            break;
                        } else if (j == sun.length() - 1) {
                            System.out.println("输入正确，结果为：" + sun);
                            break loop;
                        }
                    }
                }else {
                    System.out.println("输入错误！");
                }
            }
        }

    }
}
